package com.wzf.greattruth.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    public static final String PATTERN_TIMESTEMP = "yyyy-MM-dd HH:mm:ss";
    public static final String PATTERN_TIMESTEMP_SSS = "yyyy-MM-dd HH:mm:ss:SSS";

    public static String formatTime(long time) {
        return formatTime(new Date());
    }

    public static String formatTime(Date time, String format) {
        SimpleDateFormat dateformat = new SimpleDateFormat(format);
        return dateformat.format(time);
    }
    public static String formatTime(Date time) {
        return formatTime(time, PATTERN_TIMESTEMP);
    }
}
